import {
  createStore,
  applyMiddleware,
  combineReducers
}from "redux";


// 异步处理中间件
// 当我们要进行异步action,action是一个函数时,我们dispatch的函数就会提交到中间件
// 中间件 帮我们执行函数,一般函数中会有一个dispatch再次派发到store中
import thunk from "redux-thunk"

import countReducer from "./reducers/countReducer"
import movieReducer from "./reducers/movieReducer"


console.log("store调用了")

// 使用redux提供的combineReducers方法  合并多个reducer  合并后要注意 再拿值就是多个值了
const allReducer=combineReducers({
  count:countReducer,
  movie: movieReducer
  })



// 创建store  并提供对应的reducer
const store =createStore(allReducer,applyMiddleware(thunk))

export default store;